package zl.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import zl.bean.RespBean;
import zl.service.IndexService;
import zl.vo.option1Vo;
import zl.vo.option2Vo;

import java.sql.SQLException;
import java.util.List;

@Controller
@RequestMapping("/api/index")
public class IndexController {
    @Autowired
    IndexService indexService;

    @GetMapping("/option1")
    @ResponseBody
    private RespBean  option1() throws SQLException {
        option1Vo option1Vo = indexService.option1();
        return RespBean.ok("查询成功",option1Vo);
    }

    @GetMapping("/option2")
    @ResponseBody
    private RespBean  option2() throws SQLException {
        List<option2Vo> list = indexService.option2();
        return RespBean.ok("查询成功",list);

    }


}
